<!DOCTYPE html >
<html>

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>Test Suite</title>
  <link rel="stylesheet" href="https://code.jquery.com/qunit/qunit-2.13.0.css">
  <script src="https://cdnjs.cloudflare.com/ajax/libs/brython/3.9.0/brython.min.js" defer></script>
  <script src="https://code.jquery.com/qunit/qunit-2.13.0.js"></script>
</head>

<body onload="brython(1)">
<div id="qunit"></div>
<div id="qunit-fixture"></div>
<script type="text/python">
from browser import window

def python_add(a, b):
  return a + b

window.py_add = python_add

print("After python_add to JS")
</script>

<script>
const js_add = (a, b) => a + b;
QUnit.module('js_add_test', function() {
  QUnit.test('should add two numbers', function(assert) {
    assert.equal(js_add(1, 1), 2, '1 + 1 = 2');
  });
});

QUnit.module('py_add_test', function() {
  QUnit.test('should add two numbers in Brython', function(assert) {
    assert.equal(py_add(2, 3), 5, '2 + 3 = 5 (python)');
  });
});

QUnit.module('py_add_failed_test', function() {
  QUnit.test('should add two numbers in Brython (failure)', function(assert) {
    assert.equal(py_add(2, 3), 6, '2 + 3 != 6 (python)');
  });
});

</script>
</body>
</html>
